home *** CD-ROM | disk | FTP | other *** search
/ Aminet 23 / Aminet 23 (1998)(GTI - Schatztruhe)[!][Feb 1998].iso / Aminet / dev / misc / gms_dev.lha / GMSDev / Source / Asm / Screens / ScrollMemory.s < prev   
Text File  |  1997-12-16  |  4KB  |  154 lines

  1. ;-------T-------T------------------------T----------------------------------;
  2. ;Name:      Scroll Memory
  3. ;Author:    Paul Manias
  4. ;Copyright: DreamWorld Productions (c) 1996-1997.  Freely distributable.
  5. ;
  6. ;This demo shows you the power of the scrolling features by allowing you
  7. ;to scroll all over your chip ram :-).  Usually you would set limits to stop
  8. ;you from going over the boundaries, but that's up to you.
  9. ;
  10. ;Use mouse to move around, LMB exits.
  11.  
  12.     INCDIR    "GMSDev:Includes/"
  13.     INCLUDE    "dpkernel/dpkernel.i"
  14.  
  15.     SECTION    "Demo",CODE
  16.  
  17. ;===========================================================================;
  18. ;                             INITIALISE DEMO
  19. ;===========================================================================;
  20.  
  21.     STARTDPK
  22.  
  23. Start:    MOVEM.L    A0-A6/D1-D7,-(SP)
  24.     move.l    DPKBase(pc),a6
  25.     lea    ScreenTags(pc),a0
  26.     sub.l    a1,a1
  27.     CALL    Init
  28.     tst.l    d0
  29.     beq.s    .Exit
  30.  
  31.     lea    PictureTags(pc),a0
  32.     move.l    Screen(pc),a1
  33.     move.l    GS_MemPtr1(a1),PicData
  34.     sub.l    a1,a1
  35.     CALL    Init
  36.     tst.l    d0
  37.     beq.s    .Exit
  38.  
  39.     moveq    #ID_JOYDATA,d0    ;Get joydata structure.
  40.     CALL    Get
  41.     move.l    d0,JoyData
  42.     beq.s    .Exit
  43.     move.l    d0,a0    ;Initialise the joydata structure.
  44.     sub.l    a1,a1
  45.     CALL    Init
  46.     tst.l    d0
  47.     beq.s    .Exit
  48.  
  49.     move.l    Screen(pc),a0
  50.     CALL    Display
  51.  
  52.     bsr.s    Main
  53.  
  54. .Exit    move.l    DPKBase(pc),a6
  55.     move.l    JoyData(pc),a0
  56.     CALL    Free
  57.     move.l    Picture(pc),a0
  58.     CALL    Free
  59.     move.l    Screen(pc),a0
  60.     CALL    Free
  61.     MOVEM.L    (SP)+,A0-A6/D1-D7
  62.     moveq    #ERR_OK,d0
  63.     rts
  64.  
  65. ;===========================================================================;
  66. ;                                MAIN LOOP
  67. ;===========================================================================;
  68.  
  69. Main:
  70. .loop    move.l    DPKBase(pc),a6
  71.     move.l    JoyData(pc),a0
  72.     CALL    Query
  73.  
  74.     move.l    JoyData(pc),a0
  75.     move.w    JD_XChange(a0),d0
  76.     move.w    JD_YChange(a0),d1
  77.     move.l    JD_Buttons(a0),d2
  78.     btst    #JB_RMB,d2
  79.     bne.s    .done
  80.     ;btst    #JB_LMB,d2
  81.     ;bne.s    .MoveScreen
  82. .MovePicture
  83.     move.l    SCRBase(pc),a6
  84.     move.l    Screen(pc),a0
  85.     add.w    d0,GS_BmpXOffset(a0)
  86.     add.w    d1,GS_BmpYOffset(a0)
  87.     CALL    scrRemakeScreen
  88.     move.l    Screen(pc),a0
  89.     CALL    scrMoveBitmap
  90.     CALL    scrWaitAVBL
  91.     bra.s    .loop
  92.  
  93. .MoveScreen
  94.     move.l    SCRBase(pc),a6
  95.     move.l    Screen(pc),a0
  96.     add.w    d0,GS_XOffset(a0)
  97.     add.w    d1,GS_YOffset(a0)
  98.     move.l    Screen(pc),a0
  99.     CALL    scrRemakeScreen
  100.     move.l    Screen(pc),a0
  101.     CALL    scrMoveBitmap
  102.     CALL    scrWaitAVBL
  103.     bra.s    .loop
  104. .done    rts
  105.  
  106. ;===========================================================================;
  107. ;                                  DATA
  108. ;===========================================================================;
  109.  
  110. JoyData:    dc.l  0
  111.  
  112. ScreenTags:    dc.l  TAGS_SCREEN
  113. Screen:        dc.l  0
  114.         dc.l  GSA_Palette,SPalette
  115.         dc.l  GSA_Width,320
  116.         dc.l  GSA_Height,256
  117.         dc.l    GSA_BitmapTags,0
  118.         dc.l    BMA_AmtColours,32
  119.         dc.l    TAGEND,0
  120.         dc.l  GSA_Attrib,HSCROLL|VSCROLL|SBUFFER|CENTRE
  121.         dc.l  TAGEND
  122.  
  123. PictureTags:    dc.l  TAGS_PICTURE
  124. Picture:    dc.l  0
  125.         dc.l    PCA_BitmapTags,0
  126.         dc.l    BMA_Data
  127. PicData:    dc.l    0
  128.         dc.l    BMA_Width,320
  129.         dc.l    BMA_Height,256
  130.         dc.l    BMA_AmtColours,32
  131.         dc.l    TAGEND,0
  132.         dc.l  PCA_Palette,SPalette
  133.         dc.l  PCA_Source,.file
  134.         dc.l  TAGEND
  135.  
  136. .file        FILENAME "GMS:demos/data/PIC.Green"
  137.  
  138. SPalette:    dc.l  PALETTE,32
  139.         dc.l  $000000,$103000,$F0C0B0,$F0A090,$D08080,$906050
  140.         dc.l  $604040,$201010,$400000,$404040,$F0F000,$403020
  141.         dc.l  $C0C000,$105000,$500010,$808000,$206010,$207010
  142.         dc.l  $308020,$409020,$50A030,$50B040,$607070,$60C040
  143.         dc.l  $708080,$90A0A0,$B0C0C0,$800010,$900010,$A00020
  144.         dc.l  $700010,$600010
  145.  
  146. ;===========================================================================;
  147.  
  148. ProgName:    dc.b  "Scroll Memory",0
  149. ProgAuthor:    dc.b  "Paul Manias",0
  150. ProgDate:    dc.b  "10 December 1997",0
  151. ProgCopyright:    dc.b  "DreamWorld Productions (c) 1996-1997.  Freely distributable.",0
  152. ProgShort:    dc.b  "Allows you to scroll over your video memory.",0
  153.         even
  154.